package chapter10;

public class Time {

	private int hours;
	private int minutes;
	private int seconds;
	
	public Time(){
		this(System.currentTimeMillis());
	}
	
	public Time(long elapseTimeMills){
		long totalSeconds = elapseTimeMills / 1000;
		long totalMinutes = totalSeconds / 60;
		long totalHours = totalMinutes / 60;
		seconds = (int) totalSeconds % 60;
		minutes = (int) totalMinutes % 60;
		hours = (int) totalHours % 24;
	}
	
	public Time(int hours,int minutes,int seconds){
		this.hours = hours;
		this.minutes = minutes;
		this.seconds = seconds;
	}
	
	public int getHours(){
		return this.hours;
	}
	
	public int getMinutes(){
		return this.minutes;
	}
	
	public int getSeconds(){
		return this.seconds;
	}

	public void setHours(int hours){
		this.hours = hours;
	}
	
	public void setMinutes(int minutes){
		this.minutes = minutes;
	}

	public void setSeconds(int seconds){
		this.seconds = seconds;
	}

	public void setTime(long elapseTime){
		long totalSeconds = elapseTime / 1000;
		long totalMinutes = totalSeconds / 60;
		long totalHours = totalMinutes / 60;
		seconds = (int) totalSeconds % 60;
		minutes = (int) totalMinutes % 60;
		hours = (int) totalHours % 24;
	}
	
	
}
